// pages/shopCar/newly/newly.js
Component({

  /**
   * 页面的初始数据
   */
  data: {

    name: "",
    phone: "",
    procince: "",
    city: "",
    area: "",
    detailed: "",
    AddAddress: {},
  },
  methods: {
    family(e) {
      this.setData({
        name: e.detail.value,
      })

    },
    tel(e) {
      this.setData({
        phone: e.detail.value,
      })

    },
    contry(e) {
      this.setData({
        procince: e.detail.value.substring(0, 2),
        city: e.detail.value.substring(2, 4),
        area: e.detail.value.substring(4)
      })

    },
    town(e) {
      this.setData({
        detailed: e.detail.value,
      })

    },
    getAddressInfo() {
      wx.request({
        url: 'http://api_devs.wanxikeji.cn/api/userAddressAddModify?token=3c35c3d0738a879f23926f4676b2874e',
        method: "POST",
        data: {
          "name": this.data.name,
          "phone": this.data.phone,
          "procince": this.data.procince,
          "city": this.data.city,
          "area": this.data.area,
          "detailed": this.data.detailed,
        },
        header: {
          'content-type': 'application/json' // 默认值
        },
        success: function (res) {
          console.log(res.data)
          // AddAddress:res.data
        }
      })
    },
  },
  /**
    * 生命周期函数--监听页面加载
    */
  onLoad: function (options) {

  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})